<?php

namespace App\Http\Requests;

use Illuminate\Support\Arr;

class InspectionRequest extends FormRequest
{
    public function rules()
    {
        $rules = [
            'inspection_user_name' => 'required',
            'inspection_user_phone' => 'required',
            'inspection_type' => 'required',
            'inspection_content' => 'required',
            'inspection_img' => 'string',
            'housings_id' => 'required',
            'inspection_status'=>'required',
            ];

        if ($this->isMethod('put')) {
            $rules = Arr::only($rules, $this->keys());
        }

        return $rules;
    }

    public function messages()
    {
        return [
            //
        ];
    }

    public function attributes()
    {
        return [
            'inspection_user_name' => '巡检人',
            'inspection_user_phone' => '巡检人电话',
            'inspection_type' => '问题类型',
            'inspection_content' => '问题描述',
            'inspection_img' => '问题图片',
            'housings_id' => '问题房间',
            'inspection_status' => '问题房间',
        ];
    }
}
